import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {rules} from '/@/utils/helper/validator';
import {render} from '/@/utils/common/renderUtils';
import {getWeekMonthQuarterYear} from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
	// {
	//   title: 'chargingOrder',
	//   align: 'center',
	//   dataIndex: 'name',
	//   slots: { customRender: 'name' },
	// },
	{
		title: 'VIN',
		align: 'center',
		dataIndex: 'vin',
	},
	{
		title: '近30天充电量（度）',
		align: 'center',
		dataIndex: 'avgElectricEnergy',
	},
	{
		title: '近30天充电次数',
		align: 'center',
		dataIndex: 'chargingTimes',
	},
	{
		title: '使用充电站数',
		align: 'center',
		dataIndex: 'chargingStationNum',
	},
	{
		title: '近30天充电时长（分）',
		align: 'center',
		dataIndex: 'chargingTotalTime',
	},
	{
		title: '单次平均充电量（度）',
		align: 'center',
		dataIndex: 'avgElectricEnergy',
	},
	{
		title: '单次平均充电时长（分）',
		align: 'center',
		sorter: true,
		dataIndex: 'avgChargingTime',
	},
	{
		title: '近30天预警数',
		align: 'center',
		sorter: true,
		dataIndex: 'chargingWarnNum',
	},
	{
		title: '高风险预警',
		align: 'center',
		dataIndex: 'chargingHighWarnNum',
	},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
		label: 'VIN',
		field: 'vin',
		component: 'Input',
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
	{
		label: 'VIN',
		field: 'vin',
		component: 'Input',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入VIN!'}];
		},
	},
	{
		label: '近30天充电量（度）',
		field: 'avgElectricEnergy',
		component: 'Input',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入近30天充电量（度）!'}];
		},
	},
	{
		label: '近30天充电次数',
		field: 'chargingTimes',
		labelWidth: 180,
		component: 'Input',
		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入使用充电站数!'}];
		},
	},
	{
		label: '使用充电站数',
		field: 'chargingStationNum',
		component: 'Input',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入使用充电站数!'}];
		},
	},
	{
		label: '近30天充电时长（分）',
		field: 'chargingTotalTime',
		component: 'Input',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入近30天充电时长!'}];
		},
	},
	{
		label: '单次平均充电量（度）',
		field: 'electricEnergy',
		component: 'Input',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入单次平均充电量（度）!'}];
		},
	},
	{
		label: '单次平均充电时长（分）',
		field: 'avgChargingTime',
		component: 'InputNumber',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入单次平均充电时长（分）'}];
		},
	},
	{
		label: '近30天预警数',
		field: 'chargingWarnNum',
		component: 'InputNumber',
		labelWidth: 180,

		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入近30天预警数'}];
		},
	},
	{
		label: '高风险预警',
		labelWidth: 180,
		field: 'chargingHighWarnNum',

		component: 'Input',
		dynamicRules: ({model, schema}) => {
			return [{required: true, message: '请输入高风险预警!'}];
		},
	},

	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false,
	},
];

// 高级查询数据
export const superQuerySchema = {
	name: {title: '运营商名称', order: 0, view: 'text', type: 'string'},
	vin: {title: 'VIN', order: 1, view: 'text', type: 'string'},
	chargingStationNum: {title: '使用充电站数', order: 2, view: 'text', type: 'string'},
	electricEnergy: {title: '单次平均充电量（度）', order: 3, view: 'text', type: 'string'},
	chargingStationCount: {title: '单次平均充电时长（分）', order: 4, view: 'number', type: 'number'},
	totalPower: {title: '近30天预警数', order: 5, view: 'number', type: 'number'},
	contactPerson: {title: '高风险预警', order: 6, view: 'text', type: 'string'},
	avgElectricEnergy: {title: '近30天充电量（度）', order: 7, view: 'text', type: 'string'},
	createTime: {title: '创建时间', order: 8, view: 'date', type: 'string'},
	logo: {title: '运营商Logo URL', order: 9, view: 'image', type: 'string'},
	chargingTimes: {title: '近30天充电次数', order: 10, view: 'text', type: 'string'},
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}
